﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CI.Models.Data;
using CI.Models.Production;

namespace PICLI
{
    class Program
    {
        static void Main(string[] args)
        {
            if (args.Count()!=2)
            {
                Console.WriteLine("2 args required, typeID and output quantity");
                return;
            }

            var typeID = Int32.Parse(args[0]);
            var outputQuantity = Int32.Parse(args[1]);

            var productionRepo = new XmlDataRepository<Item>("Production.xml");
            productionRepo.Load();
            dynamic robotics = productionRepo.Get(typeID);

            var piModelManager = new PIJobModelManager();

            var chain = piModelManager.AddChainFor(robotics,
                                       new PIModelOptions {MinimumManufacturingLevel = PIManufacturingLevel.Resource});

            chain.Output.Quantity.Total = outputQuantity;

            var pig = new PIGenerator {Manager = piModelManager};

            pig.GenerateXml();
            pig.WriteFile();
        }
    }
}
